Skip to content

[IR2Vec][llvm-ir2vec] Add support for reading from stdin #149213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

svkeerthy
Copy link
Contributor

@svkeerthy svkeerthy commented Jul 16, 2025

Add support for reading LLVM IR from stdin in the llvm-ir2vec tool.

This allows usage of the tool in pipelines where LLVM IR is generated or transformed on-the-fly just like the other llvm tools. Useful in upcoming PRs.

(Tracking issue - #141817)

Copy link
Contributor Author

svkeerthy commented Jul 16, 2025

@svkeerthy svkeerthy changed the title support-stdin-input-llvm-ir2vec [IR2Vec][llvm-ir2vec] Add support for reading from stdin Jul 16, 2025
@svkeerthy svkeerthy marked this pull request as ready for review July 16, 2025 22:56
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch from 6efc8a8 to 9e17794 Compare July 16, 2025 23:32
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-exposing-new-methods branch 2 times, most recently from bc03736 to 68ae9f5 Compare July 16, 2025 23:46
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch from 9e17794 to 1e22261 Compare July 16, 2025 23:46
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-exposing-new-methods branch from 68ae9f5 to 1d7ca80 Compare July 17, 2025 18:04
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch from 1e22261 to 0903552 Compare July 17, 2025 18:04
Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits at this point, otherwise LGTM.

@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-exposing-new-methods branch from 1d7ca80 to 01c6091 Compare July 17, 2025 19:11
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch from 0903552 to 7fee589 Compare July 17, 2025 19:12
@svkeerthy svkeerthy requested a review from Copilot July 17, 2025 19:36
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for reading LLVM IR from stdin by allowing "-" as the positional input filename and updating the parsing logic.

  • Changed InputFilename option to default to "-" and updated its description for stdin support
  • Refactored main to introduce a placeholder for stdin handling and unconditionally call parseIRFile
Comments suppressed due to low confidence (1)

llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp:54

  • The new stdin support path isn't covered by existing tests. Consider adding unit or integration tests that pipe LLVM IR into stdin (using -) to verify the feature works end-to-end.
                  cl::init("-"), cl::cat(IR2VecToolCategory));

@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-exposing-new-methods branch from 01c6091 to f24c6f1 Compare July 17, 2025 19:55
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch 2 times, most recently from 36ecab5 to 32275ce Compare July 17, 2025 19:58
Copy link
Contributor Author

svkeerthy commented Jul 17, 2025

Merge activity

  • Jul 17, 8:36 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 17, 8:41 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 17, 8:43 PM UTC: @svkeerthy merged this pull request with Graphite.

@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-exposing-new-methods branch from f24c6f1 to faf9baa Compare July 17, 2025 20:37
Base automatically changed from users/svkeerthy/07-16-exposing-new-methods to main July 17, 2025 20:40
@svkeerthy svkeerthy force-pushed the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch from 32275ce to a47b7f7 Compare July 17, 2025 20:41
@svkeerthy svkeerthy merged commit 202f30e into main Jul 17, 2025
7 of 9 checks passed
@svkeerthy svkeerthy deleted the users/svkeerthy/07-16-support-stdin-input-llvm-ir2vec branch July 17, 2025 20:43
Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have thought of this during the review: You might want to add a test somewhere that checks this actually works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants